import type { TableColumn } from '@/components/core/dynamic-table';
import { router } from '@/router';

export type TableListItem = API.ApproveTaskListPageResult;
export type TableColumnItem = TableColumn<TableListItem>;

const caseNodeStatus = (val) => {
  switch (val) {
    case 1:
      // return '待审批';
      return '-';
    case 2:
      return '同意';
    case 3:
      return '不同意';
    default:
      return '-';
  }
};

export const approveCoumns: TableColumn[] = [
  {
    title: '节点名称',
    width: 60,
    dataIndex: 'flowNodeName',
    hideInSearch: true,
  },
  {
    title: '审批人',
    dataIndex: 'approveName',
    width: 60,
    hideInSearch: true,
  },
  {
    title: '审批时间',
    width: 60,
    dataIndex: 'approveTime',
    hideInSearch: true,
  },
  {
    title: '审批结果',
    width: 60,
    dataIndex: 'nodeStatus',
    hideInSearch: true,
    customRender: ({ record }) => caseNodeStatus(record.nodeStatus),
  },
  {
    title: '审批意见',
    width: 120,
    dataIndex: 'approveOpinions',
    hideInSearch: true,
  },
];
